$(function() {
			// 视频播放
			$("input[previewflv],div[previewflv]").live("click", function() {
						var pathvalue = $(this).attr("href");
						var name = $(this).attr("name");
						if (name) {
							ship(name, pathvalue);
						} else {
							ship("", pathvalue);
						}

			});
			
			//上传多图片,上一张
			$("a[multiPicsPre]").live("click",function(){
				var $one  = $(this).parent().parent().parent();//获取本身
				var $two = $one.prev();
				
				if( $two.is(".fl")!= -1){
						//说明上面有一张，可以进行互换
						$one.insertBefore($two);
						
				}
				
			})
			
			//上传多图片,下一张
			$("a[multiPicsNext]").live("click",function(){
				var $one  = $(this).parent().parent().parent();//获取本身
				var $two = $one.next();
				
				if( $two.is(".fl")!= -1){
						//说明上面有一张，可以进行互换
						$one.insertAfter($two);
						
				}
				
			})
			
			$("a[multiPicsDele]").live("click",function(){
				$(this).parent().parent().parent().remove();
			})
});
		
function ship(tit, vsrc) {
	alertDiv(tit, 700, 500, vsrc, vsrc);
}

// 第一个参数为弹出层标题，第二个参数为弹出层宽，第三个参数为弹出层高，第四个参数为弹出层内容id,第五个参数设置是否有透明圆角背景层：0表示有，1表示没有，第六个参数表示关闭按钮位置在里面还是外面：0表示关闭按钮在外面，1表示关闭按钮在里面
function alertDiv(title, width, height, isrc, vsrc) {// 弹出层带有内容

	// 屏蔽滚动条
	$("body").css("overflow", "hidden");

	var titles = title || "标题";
	var Iheight = $(window).height();
	var Iwidth = $(window).width();
	var allheight = $(document).height();
	var heights = height || 300;
	var widths = width || 500;
	var sheight = $(document).scrollTop();
	var Oheight = (Iheight - heights) / 2 + sheight;
	var Owidth = (Iwidth - widths) / 2;
	var borWidth = widths + 10;
	var borHeight = heights + 10;
	var borOtop = (Iheight - borHeight) / 2 + sheight;
	var borOleft = (Iwidth - borWidth) / 2;
	var conHeight = heights - 70;
	var _src = isrc;
	var vedio_src = vsrc;
	var sp_w = widths - 60;
	var sp_h = conHeight - 50;
	var bgDiv = "<div id='InDiv' style='width:"
			+ Iwidth
			+ "px;height:"
			+ allheight
			+ "px;background-color:#000;position:absolute;z-index:97;top:0;left:0;filter:alpha(Opacity=60); opacity:0.6; -moz-opacity:0.6; -webkit-opacity:0.6;' onclick='alertCloses()'></div>";

	
	var div = "<div id='borDiv' style='width:"
			+ borWidth
			+ "px;height:"
			+ borHeight
			+ "px;left:"
			+ borOleft
			+ "px;top:0px;position:absolute; z-index:98; background-color:#fff; filter:alpha(Opacity=30); opacity:0.3; -moz-opacity:0.3; -webkit-opacity:0.3; border-radius:15px; -moz-border-radius:15px; -webkit-border-radius:15px;'></div>"
			+ "<div id='offDiv' style='width:"
			+ widths
			+ "px;height:"
			+ heights
			+ "px;left:"
			+ Owidth
			+ "px;top:0px;background-color:white;position:absolute;z-index:99; border-radius:15px; -moz-border-radius:15px; -webkit-border-radius:15px;'>"
			+ "<a id='AClose' onclick='alertCloses()' class='tc_close' ></a>"
			+ "<h4  class='tc_Tit' style='margin-top:10px;margin-left:15px;'>"
			+ titles
			+ "</h4><div style='height:"
			+ conHeight
			+ "px; overflow:auto;'><div  id='Content' style='padding:40px 30px 0 30px;;'></div></div></div>";
	
	$(document.body).append(bgDiv);
	$(document.body).append(div);
	
	$("#borDiv").animate({top : borOtop,opacity : 'show'}, 300);
	$("#offDiv").animate({top : Oheight,opacity : 'show'}, 300);

	var s1 = new SWFObject("sc_ls/flash/flvplayer.swf", "single", sp_w, sp_h,"7");
	
	s1.addParam("allowfullscreen", "true");
	s1.addParam("wmode", "opaque");
	s1.addVariable("autostart", "false"); // 打开时自动播放
	s1.addVariable("backcolor", "0x000000");//背景色
	s1.addVariable("frontcolor", "0xCCCCCC");
	s1.addVariable("file", "../../"+ vedio_src);//文件路径
	s1.addVariable("image", _src); // 封面图片的调用
	s1.addVariable("width", sp_w);
	s1.addVariable("height", sp_h);
	
	s1.write("Content");
}

function alertCloses() {// 关闭带丰富内容弹出层
	$("body").css("overflow", "auto");
	$("#InDiv").remove();
	$("#borDiv").remove();
	$("#offDiv").remove();
}


